package 力扣热题100;

import java.util.Arrays;

public class LeetCode22 {
    public void rotate(int[][] matrix) {
        for (int i = 0; i < matrix.length; i++) {
            for (int j = i; j < matrix[0].length; j++) {
                int tmp=matrix[i][j];
                matrix[i][j]=matrix[j][i];
                matrix[j][i]=tmp;
            }
        }
        int l=matrix[0].length;
        for (int j = 0; j < l/2; j++) {
            for (int i = 0; i < l; i++) {
                int tmp=matrix[i][j];
                matrix[i][j]=matrix[i][l-j-1];
                matrix[i][l-j-1]=tmp;
            }
        }
    }

    public static void main(String[] args) {
        LeetCode22 leetCode22=new LeetCode22();
        leetCode22.rotate(new int[][]{{5,1,9,11},{2,4,8,10},{13,3,6,7},{15,14,12,16}});
    }
}
